﻿
@{
    ViewBag.Title = "SafetyIndexFormAdd";
    Layout = "~/Views/Shared/_LayoutMain.cshtml";
}

@section css{
    <link href="~/Assets/css/lib/bootstrap-select.css" rel="stylesheet" />
    <link href="~/Assets/css/lib/fileinput.css" rel="stylesheet" />
    <link href="~/Assets/css/lib/bootstrap-datetimepicker.min.css" rel="stylesheet" />
    <style>
        .required {
            color: red;
        }
    </style>
}

<header id="topbar">
    <div class="topbar-left">
        <ol class="breadcrumb">
            <li class="crumb-active">
                <a>填写安全指标</a>
            </li>
            <li class="crumb-trail">安全指标</li>
        </ol>
    </div>
</header>

<div id="content" ng-cloak ng-controller="SafetyIndexController" ng-init="DataLoading=false;LoadingMsg='正在导入...';page='@(Request.QueryString["page"].IsEmpty() ? "1" : Request.QueryString["page"])';
     GetMySafetyIndexTypeList();
     GetIndexItemPageList(page);
    ">
    <div class="load" ng-show="DataLoading">
        <div class="loader">
            <svg version="1.1" id="loader-1" x="0px" y="0px" width="100px" height="100px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
            <path fill="#000" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z">
            <animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite" />
			</path>
		</svg>
            <div class="load-msg" ng-bind="LoadingMsg"></div>
        </div>
    </div>
    <div class="row" ng-repeat="x in TypeList">
        <div class="col-md-12">
            <div class="panel panel-primary panel-border top mb35">
                <div class="panel-heading">
                    <span class="panel-title">填写{{x.Name}}指标信息</span>
                </div>
                <div class="panel-body">
                    <form class="form-horizontal" role="form">
                        <table class="table table-bordered">
                            <thead>
                                <tr class="bg-light">
                                    <th style="width:5%;">一级指标</th>
                                    <th style="width:5%;">二级指标</th>
                                    <th style="width:5%;">二级指标权重</th>
                                    <th style="width:7%;">三级指标</th>
                                    <th style="width:5%;">三级指标权重</th>
                                    <th style="width:5%;">总比重</th>
                                    <th style="width:4%;">赋值</th>
                                    <th style="width:4%;">数据情况</th>
                                    <th style="width:4%;">自动/手动</th>
                                    <th style="width:4%;">频次</th>
                                    <th style="width:8%;">来源</th>
                                    <th style="width:15%;">判断标准</th>
                                    <th style="width:8%;">责任人</th>
                                    <th style="width:8%;">操作</th>
                                </tr>
                            </thead>

                            <tbody ng-repeat="y in x.SonList track by $index">
                            <td rowspan="{{x.AllNodesCount}}">{{x.Name}}</td>
                            <tr ng-repeat="z in y.SonList track by $index">
                                <td ng-if="$index==0" rowspan={{y.SonList.length}}>{{y.Name}}</td>
                                <td ng-if="$index==0" rowspan={{y.SonList.length}}>{{y.Percent}}</td>
                                <td>{{z.IndexName}}</td>
                                <td>{{z.Percent*100}}%</td>
                                <td>{{(y.Percent*100)*(z.Percent*100)/10000}}</td>
                                <td><input type="text" class="form-control" style="width:60px;" value="{{z.CurrentScore}}" /></td>
                                <td>{{z.DataStatus}}</td>
                                <td>{{z.IsAutomatic}}</td>
                                <td>{{z.Interval}}</td>
                                <td>{{z.Source}}</td>
                                <td>{{z.Standard}}</td>
                                <td>{{z.ResponsibleName}}</td>
                                <td><a class="btn btn-primary" data-toggle="modal" href="#EditModal" ng-click="InitIndexItemForm(z);BindDepartmentList('Dep_Select');">扣分</a></td>
                            </tr>
                            </tbody>
                        </table>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-md-12">
            <div class="panel panel-info panel-border top mb35">
                <div class="panel-heading">
                    <span class="panel-title">安全指标扣分事件列表</span>
                </div>
                <div class="panel-body">
                    <form class="form-horizontal" role="form">
                        <table class="table table-bordered">
                            <thead>
                                <tr class="bg-light">
                                    <th style="width:2%;text-align:center;">序号</th>
                                    <th style="width: 5%; text-align: center;">二级指标</th>
                                    <th style="width: 7%; text-align: center;">三级指标</th>
                                    <th style="width: 2%; text-align: center;">扣分值</th>
                                    <th style="width: 5%; text-align: center;">事件时间</th>
                                    <th style="width: 14%; text-align: center;">事件描述</th>
                                    <th style="width: 4%; text-align: center;">登记人</th>
                                    <th style="width: 4%; text-align: center;">登记时间</th>
                                    <th style="width: 4%; text-align: center;">状态</th>
                                    <th style="width: 4%; text-align: center;">操作</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr ng-show="IndexItemList==null || IndexItemList.length==0">
                                    <td colspan="9" style="text-align:center;">暂无数据</td>
                                </tr>
                                <tr ng-repeat="x in IndexItemList">
                                    <td style="text-align:center;">
                                        <span ng-bind="$index+1"></span>
                                    </td>
                                    <td style="text-align:center;" ng-bind="x.PartentIndexName"></td>

                                    <td ng-bind="x.TypeName"></td>
                                    <td style="text-align:center;" ng-bind="x.DataValue"></td>
                                    <td style="text-align:center;">{{x.EventTime|JSONDate:'yyyy-MM-dd'}}</td>
                                    <td ng-bind="x.Description"></td>
                                    <td style="text-align:center;" ng-bind="x.CreateUserName"></td>

                                    <td style="text-align:center;">{{x.CreateTime|JSONDate:'yyyy-MM-dd HH:mm'}}</td>
                                    <td style="text-align:center;"><span ng-show="x.Status==0" class="label label-default">已撤销</span><span ng-show="x.Status==1" class="label label-primary">生效</span></td>
                                    <td>
                                        <button ng-show="x.Status==1" ng-click="RemoveIndexItem(x.Id,result.currentPage);" class="btn btn-danger btn-xs btn-label"><i class="fa fa-stop"></i> 撤销</button>
                                        <button ng-show="x.Status==0" ng-click="RestoreIndexItem(x.Id,result.currentPage);" class="btn btn-warning btn-xs btn-label"><i class="fa fa-play"></i> 恢复</button>
                                        <button ng-click="DeleteIndexItem(x.Id,result.currentPage);" class="btn btn-default btn-xs btn-label"><i class="fa fa-trash"></i> 删除</button>
                                    </td>
                                </tr>
                            </tbody>
                        </table>


                    </form>
                </div>
            </div>
        </div>
    </div>


    <div class="modal fade" id="EditModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="min-width:985px;">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h2 class="modal-title">{{AddModel.TypeName}}</h2>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal" role="form">
                        <div class="form-group">
                            <label class="col-lg-2 control-label">扣分值：</label>
                            <div class="col-lg-3">
                                <input type="number" class="form-control" ng-model="AddModel.DataValue" ng-init="AddModel.DataValue=1;">
                            </div>
                            <label class="col-lg-2 control-label">发生时间：</label>
                            <div class="col-lg-3">
                                <datepicker id="startTime" option="datetimeOption" format="L HH:mm" ng-model="AddModel.EventTime"></datepicker>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">责任部门：</label>
                            <div class="col-sm-3">
                                <select id="Dep_Select" class="selectpicker show-tick form-control" ng-model="AddModel.DepartmentId" ng-change="GetImportantList(SearchModel,1);" data-live-search="true">
                                    <option value="" selected>请选择部门</option>
                                </select>
                            </div>
                            <label class="col-lg-2 control-label">责任人：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="AddModel.Responsible" ng-init="AddModel.Responsible=''">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">事件描述：</label>
                            <div class="col-lg-8">
                                <textarea type="text" class="form-control" ng-model="AddModel.Description"></textarea>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal" id="btn_close">关闭</button>
                    <button type="button" class="btn btn-primary" ng-click="SubmitIndexFormItem(AddModel);">提交</button>
                </div>
            </div>
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
</div>

@section Js{
    <script src="~/Bussiness/js/libs/upload.js"></script>
    <script src="~/Bussiness/js/pg/SafetyIndex.js?v=@DateTime.Now.ToString("yyMMddHHmm")"></script>
    <script src="~/Bussiness/js/libs/moment.min.js"></script>
    <script src="~/Bussiness/js/libs/locales/date/zh-cn.js"></script>
    <script src="~/Bussiness/js/libs/bootstrap-datetimepicker.min.js"></script>
    <script src="~/Bussiness/js/libs/angularjs-datepicker.js"></script>
    <script src="~/Bussiness/js/libs/fileinput.js"></script>
    <script src="~/Bussiness/js/libs/zh.js"></script>
    <script>
        $('#docfiles').fileinput({
            language: 'zh'
        });
        $(".selectpicker").selectpicker({
            noneSelectedText: "请选择发布机构"
        });
    </script>
}

